package com.linian.pushforcampus.enums;

/**
 * packageName com.linian.pushforcampus.enums
 *
 * @author Lennon
 * @enumName EducationType
 * @date 2024/3/5
 * @description TODO
 */
public enum EducationType {
    DE("de", "德育"),
    ZHI("zhi", "智育"),
    TI("ti", "体育"),
    MEI("mei", "美育"),
    LAO("lao", "劳育");

    private String code;
    private String description;

    EducationType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static String getByCode(String code) {
        for (EducationType type : EducationType.values()) {
            if (type.getCode().equalsIgnoreCase(code)) {
                return type.getDescription();
            }
        }
        return null; // 或者抛出一个异常
    }

    public static String getByDescription(String description) {
        for (EducationType type : EducationType.values()) {
            if (type.getDescription().equals(description)) {
                return type.getCode();
            }
        }
        return null; // 或者抛出一个异常
    }
}

